#ifndef ___fat32_operacionAN_procesar_entrada

#define ___fat32_operacionAN_procesar_entrada 1

#include "f32_mto.c"

#include "f32_datr.c"

unsigned char fat32op_procesar_entrada_directorio(FAT32_PARAMS_OPERACION);

unsigned char fat32op_procesar_entrada_directorio (FAT32_PARAMS_OPERACION) {
  struct fat32_atributos_archivo * atribArch = malloc(sizeof(struct fat32_atributos_archivo));
  char * datos = datosEntrada;
  char atributos = datos[11];
  atribArch -> soloLectura = atributos & 1;
  atribArch -> modificado = (atributos & 32) != 0;
  atribArch -> hardlinks = (atributos & 16) == 0; // si es direcctorio, devuelvo 0 como error (para procesar posteriormente)
  atribArch -> tamano = fb_convertir_de_little_endian(datos + 28, 32);
  atribArch -> fechaCreacion = fb_convertir_de_little_endian(datos + 16, 16);
  unsigned short hc = fb_convertir_de_little_endian(datos + 14, 16);
  unsigned long horaTemp = 0;
  horaTemp = establecerBits(horaTemp, 22, 5, obtenerBits(hc, 11, 5));
  horaTemp = establecerBits(horaTemp, 16, 6, obtenerBits(hc, 5, 6));
  horaTemp = establecerBits(horaTemp, 10, 6, 2 * obtenerBits(hc, 0, 5) + (datos[13] >= 100));
  horaTemp = establecerBits(horaTemp, 0, 10, 10 * (datos[13] % 100));
  atribArch -> horaCreacion = horaTemp;
  unsigned long c1, c2;
  c1 = fb_convertir_de_little_endian(datos + 20, 16);
  c2 = fb_convertir_de_little_endian(datos + 26, 16);
  c1 <<= 16;
  atribArch -> clusterInicial = c1 | c2;
  *datosSalida = atribArch;
  return (atribArch -> hardlinks) ? 1 : 2;
}

#endif